<!DOCTYPE html>
<html>
    <head>
        <title>
            {block name=head_title}Title{/block}
        </title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <link rel="stylesheet" type="text/css" href="/css/ITManagement.css" />
        <link rel="Stylesheet" type="text/css" href="/css/ITManagementStyleTable.css" />
        <link rel="stylesheet" type="text/css" href="/css/StyleCalendar.css" />
        <link rel="stylesheet" type="text/css" href="/css/Style.css" />

        <script src="//code.jquery.com/jquery-1.10.2.js"></script>
        <script src="//jquerypriceformat.com/txt/jquery.price_format.2.0.js_.txt" type="text/javascript"></script>
        <script>
            {literal} 
            $(document).ready(function () {
                $.fn.rmSplChar = function () {
                    $(this).keyup(function ()
                    {
                        var yourInput = $(this).val();
                        re = /[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi;
                        var isSplChar = re.test(yourInput);
                        if (isSplChar)
                        {
                            var no_spl_char = yourInput.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, '');
                            $(this).val(no_spl_char);
                        }
                    });
                };
            });

            function IsEmail(email) {
                var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
                return regex.test(email);
            }
            {/literal} 
            function getQH(tp) {
                $("#quanhuyen").html('');
                $("#phuongxa").html('');
                $.getJSON('/JSON.php?getTP=' + tp, function (data) {
                    $("#quanhuyen").append("<option value='0' selected>Chọn</option>");
                    $.each(data, function (key, val) {
                        $("#quanhuyen").append($("<option></option>").attr("value", val.MaQH).text(val.TenQH));
                    });
            {if isset($diachi)&& $smarty.server.REQUEST_URI != "/diachi/view"}
                    $('#quanhuyen').val({$diachi[0].MaQH});
                    getPX($("#quanhuyen").val());
            {/if}
            {if isset($diadiem)&& $smarty.server.REQUEST_URI != "/diadiem/view"}
                    $('#quanhuyen').val({$diadiem[0].MaQH});
                    getPX($("#quanhuyen").val());
            {/if}
                });
            }

            function getPX(qh) {
                $("#phuongxa").html('');
                $.getJSON('/JSON.php?getQH=' + qh, function (data) {
                    $("#phuongxa").append("<option value='0' selected>Chọn</option>");
                    $.each(data, function (key, val) {
                        $("#phuongxa").append($("<option></option>").attr("value", val.MaPX).text(val.TenPX));
                    });
            {if isset($diachi) && $smarty.server.REQUEST_URI != "/diachi/view"}
                    $('#phuongxa').val({$diachi[0].MaPX});
                    $("#address").val("{$diachi[0].DiaChi}");
            {/if}
            {if isset($diadiem) && $smarty.server.REQUEST_URI != "/diadiem/view"}
                    $('#phuongxa').val({$diadiem[0].MaPX});
                    $("#address").val("{$diadiem[0].DiaChi}");
            {/if}
                });
            }

            function fulladdress() {
                str = '';
                str += $('#address').val() + ', ';
                str += $('#phuongxa option:selected').text() + ', ';
                str += $('#quanhuyen option:selected').text() + ', ';
                str += $('#thanhpho option:selected').text();
                $('#fulladdress').text(str);
                return false;
            }
            function check_address(oForm) {
                if (oForm.thanhpho.value === "0" || oForm.thanhpho.value === null ||
                        oForm.quanhuyen.value === "0" || oForm.quanhuyen.value === null ||
                        oForm.phuongxa.value === "0" || oForm.phuongxa.value === null ||
                        oForm.address.value === "")
                {
                    alert("Bạn chưa nhập đầy đủ các thông tin!");
                    return false;
                }
                else {
                    return true;
                }
            }

            function check_diadiem(oForm) {
                if (oForm.diachi.value === "0" || oForm.diachi.value === null ||
                        oForm.chuquan.value === "0" || oForm.chuquan.value === null ||
                        oForm.quanly.value === "0" || oForm.quanly.value === null ||
                        $.trim(oForm.tenDD.value) === "")
                {
                    alert("Bạn chưa nhập đầy đủ các thông tin!");
                    return false;
                }
                else {
                    return true;
                }
            }

            function check_lienhe_chuquan(oForm) {
                if (oForm.tenChuQuan.value === "" || oForm.sdtChuQuan.value === "")
                {
                    alert("Bạn chưa nhập đầy đủ các thông tin!");
                    return false;
                }
                else {
                    return true;
                }
            }

            function check_lienhe_quanly(oForm) {
                if (oForm.tenQuanLy.value === "" || oForm.sdtQuanLy.value === "")
                {
                    alert("Bạn chưa nhập đầy đủ các thông tin!");
                    return false;
                }
                else {
                    return true;
                }
            }
            function showPopup(url) {
                newwindow = window.open(url, 'name', 'height=100,width=400,top=334,left=483,resizable');
                if (window.focus) {
                    newwindow.focus();
                }
            }
        </script>
        {block name=head_script}<script></script>{/block}

        <style type="text/css">
            .style1
            {
                font-size: xx-large;
                color:Orange;
            }

            .style2
            {
                font-size:x-large;
                color:Orange;
            }
        </style>
        {block name=head_style}<style></style>{/block}
    </head>
    <body>
        <div class="page">
            <div class="header">
                <div class="title">
                    <h1>
                        <a href="">
                            <img id="Img1" src="/images/target.png" width="300" height="122" alt="Home" style="border:none" />
                        </a>
                    </h1>
                </div>
                <br />
                <div class="title1">
                    <h2 class="style1" style="font-size:36pt;">
                        Cafe Digital LCD
                    </h2>
                </div>
            </div>
            <div class="login">
                <a href="" style="visibility: hidden">[Change Password]</a>
                Hello {$username}
                &nbsp;&nbsp;
                <a href="/logout">[Log Out]</a>
                &nbsp;&nbsp;
                <a href="" style="visibility: hidden">[Create Account]</a>
            </div>
            <br />
            <br />
            <br />
            <br />
            <br />
            <div class="main">
                <br/><br/>
                <!-- New form-->
                <div id="left" align="right">
                    <a href="/diadiem/view" style="text-decoration: none; font-weight: bold;">Địa điểm</a>&nbsp;&nbsp;
                    <a href="/diadiem/view/0/hopdong" style="text-decoration: none; font-weight: bold;">Hợp đồng</a>&nbsp;&nbsp;
                    <a href="/hopdong/expiring" style="text-decoration: none; font-weight: bold;">Hợp đồng sắp hết hạn</a>&nbsp;&nbsp;
                    <a href="/sale/view" style="text-decoration: none; font-weight: bold;">Thông tin sale</a>&nbsp;&nbsp;
                    <a href="/export/report" style="text-decoration: none; font-weight: bold;">Xuất Report</a>&nbsp;&nbsp;
                    <a href="/export/mail" style="text-decoration: none; font-weight: bold;">Gửi Report</a>&nbsp;&nbsp;
                </div>
                <br/> <br/>
                <div id="right" align="right">
                {block name=body}{/block}
            </div>
            <!-- End Detail Status-->
            <br />
        </div> 
    </div>
    <div class="clear">
    </div>
    <div class="footer">
        Copyright 2014 by GuoMing
    </div>
</body>
</html>